<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD><TITLE>Tcl_PkgRequire manual page - Tcl Library Procedures</TITLE>
<link rel="stylesheet" href="../docs.css" type="text/css" media="all">
</HEAD>
<BODY><H2><a href="../contents.htm">Tcl8.6.11/Tk8.6.11 Documentation</a> <small>&gt;</small> <a href="contents.htm">Tcl C API</a> <small>&gt;</small> PkgRequire</H2>
<H3><A HREF="../UserCmd/contents.htm">Tcl/Tk Applications</A> | <A HREF="../TclCmd/contents.htm">Tcl Commands</A> | <A HREF="../TkCmd/contents.htm">Tk Commands</A> | <A HREF="../ItclCmd/contents.htm">[incr Tcl] Package Commands</A> | <A HREF="../SqliteCmd/contents.htm">SQLite3 Package Commands</A> | <A HREF="../TdbcCmd/contents.htm">TDBC Package Commands</A> | <A HREF="../TdbcmysqlCmd/contents.htm">tdbc::mysql Package Commands</A> | <A HREF="../TdbcodbcCmd/contents.htm">tdbc::odbc Package Commands</A> | <A HREF="../TdbcpostgresCmd/contents.htm">tdbc::postgres Package Commands</A> | <A HREF="../TdbcsqliteCmd/contents.htm">tdbc::sqlite3 Package Commands</A> | <A HREF="../ThreadCmd/contents.htm">Thread Package Commands</A> | <A HREF="../TclLib/contents.htm">Tcl C API</A> | <A HREF="../TkLib/contents.htm">Tk C API</A> | <A HREF="../ItclLib/contents.htm">[incr Tcl] Package C API</A> | <A HREF="../TdbcLib/contents.htm">TDBC Package C API</A></H3>
<DL>
<DD><A HREF="PkgRequire.htm#M2" NAME="L624">NAME</A>
<DL><DD>Tcl_PkgRequire, Tcl_PkgRequireEx, Tcl_PkgRequireProc, Tcl_PkgPresent, Tcl_PkgPresentEx, Tcl_PkgProvide, Tcl_PkgProvideEx &mdash; package version control</DD></DL>
<DD><A HREF="PkgRequire.htm#M3" NAME="L625">SYNOPSIS</A>
<DL>
<DD><B>#include &lt;tcl.h&gt;</B>
<DD>const char *
<DD><B>Tcl_PkgRequire</B>(<I>interp, name, version, exact</I>)
<DD>const char *
<DD><B>Tcl_PkgRequireEx</B>(<I>interp, name, version, exact, clientDataPtr</I>)
<DD>int
<DD><B>Tcl_PkgRequireProc</B>(<I>interp, name, objc, objv, clientDataPtr</I>)
<DD>const char *
<DD><B>Tcl_PkgPresent</B>(<I>interp, name, version, exact</I>)
<DD>const char *
<DD><B>Tcl_PkgPresentEx</B>(<I>interp, name, version, exact, clientDataPtr</I>)
<DD>int
<DD><B>Tcl_PkgProvide</B>(<I>interp, name, version</I>)
<DD>int
<DD><B>Tcl_PkgProvideEx</B>(<I>interp, name, version, clientData</I>)
</DL>
<DD><A HREF="PkgRequire.htm#M4" NAME="L626">ARGUMENTS</A>
<DL class="arguments">
</DL>
<DD><A HREF="PkgRequire.htm#M5" NAME="L627">DESCRIPTION</A>
<DD><A HREF="PkgRequire.htm#M6" NAME="L628">KEYWORDS</A>
<DD><A HREF="PkgRequire.htm#M7" NAME="L629">SEE ALSO</A>
</DL>
<H3><A NAME="M2">NAME</A></H3>
Tcl_PkgRequire, Tcl_PkgRequireEx, Tcl_PkgRequireProc, Tcl_PkgPresent, Tcl_PkgPresentEx, Tcl_PkgProvide, Tcl_PkgProvideEx &mdash; package version control
<H3><A NAME="M3">SYNOPSIS</A></H3>
<B>#include &lt;tcl.h&gt;</B><BR>
const char *<BR>
<B>Tcl_PkgRequire</B>(<I>interp, name, version, exact</I>)<BR>
const char *<BR>
<B>Tcl_PkgRequireEx</B>(<I>interp, name, version, exact, clientDataPtr</I>)<BR>
int<BR>
<B>Tcl_PkgRequireProc</B>(<I>interp, name, objc, objv, clientDataPtr</I>)<BR>
const char *<BR>
<B>Tcl_PkgPresent</B>(<I>interp, name, version, exact</I>)<BR>
const char *<BR>
<B>Tcl_PkgPresentEx</B>(<I>interp, name, version, exact, clientDataPtr</I>)<BR>
int<BR>
<B>Tcl_PkgProvide</B>(<I>interp, name, version</I>)<BR>
int<BR>
<B>Tcl_PkgProvideEx</B>(<I>interp, name, version, clientData</I>)<BR>
<H3><A NAME="M4">ARGUMENTS</A></H3>
<DL class="arguments">
<DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*interp</B> (in)<DD>
Interpreter where package is needed or available.
<P><DT>const char <B>*name</B> (in)<DD>
Name of package.
<P><DT>const char <B>*version</B> (in)<DD>
A version string consisting of one or more decimal numbers
separated by dots.
<P><DT>int <B>exact</B> (in)<DD>
Non-zero means that only the particular version specified by
<I>version</I> is acceptable.
Zero means that newer versions than <I>version</I> are also
acceptable as long as they have the same major version number
as <I>version</I>.
<P><DT>const void <B>*clientData</B> (in)<DD>
Arbitrary value to be associated with the package.
<P><DT>void <B>*clientDataPtr</B> (out)<DD>
Pointer to place to store the value associated with the matching
package. It is only changed if the pointer is not NULL and the
function completed successfully. The storage can be any pointer
type with the same size as a void pointer.
<P><DT>int <B>objc</B> (in)<DD>
Number of requirements.
<P><DT><A HREF="../TclLib/Object.htm">Tcl_Obj</A>* <B>objv[]</B> (in)<DD>
Array of requirements.
<P></DL>
<H3><A NAME="M5">DESCRIPTION</A></H3>
These procedures provide C-level interfaces to Tcl's package and
version management facilities.
<P>
<B>Tcl_PkgRequire</B> is equivalent to the <B><A HREF="../TclCmd/package.htm">package require</A></B>
command, <B>Tcl_PkgPresent</B> is equivalent to the <B><A HREF="../TclCmd/package.htm">package present</A></B>
command, and <B>Tcl_PkgProvide</B> is equivalent to the
<B><A HREF="../TclCmd/package.htm">package provide</A></B> command.
<P>
See the documentation for the Tcl commands for details on what these
procedures do.
<P>
If <B>Tcl_PkgPresent</B> or <B>Tcl_PkgRequire</B> complete successfully
they return a pointer to the version string for the version of the package
that is provided in the interpreter (which may be different than
<I>version</I>); if an error occurs they return NULL and leave an error
message in the interpreter's result.
<P>
<B>Tcl_PkgProvide</B> returns <B><A HREF="../TclCmd/catch.htm">TCL_OK</A></B> if it completes successfully;
if an error occurs it returns <B><A HREF="../TclCmd/catch.htm">TCL_ERROR</A></B> and leaves an error message
in the interpreter's result.
<P>
<B>Tcl_PkgProvideEx</B>, <B>Tcl_PkgPresentEx</B> and <B>Tcl_PkgRequireEx</B>
allow the setting and retrieving of the client data associated with
the package. In all other respects they are equivalent to the matching
functions.
<P>
<B>Tcl_PkgRequireProc</B> is the form of <B><A HREF="../TclCmd/package.htm">package require</A></B> handling
multiple requirements. The other forms are present for backward
compatibility and translate their invocations to this form.
<H3><A NAME="M6">KEYWORDS</A></H3>
<A href="../Keywords/P.htm#package">package</A>, <A href="../Keywords/P.htm#present">present</A>, <A href="../Keywords/P.htm#provide">provide</A>, <A href="../Keywords/R.htm#require">require</A>, <A href="../Keywords/V.htm#version">version</A>
<H3><A NAME="M7">SEE ALSO</A></H3>
<B><A HREF="../TclCmd/package.htm">package</A></B>, <B><A HREF="../TclLib/StaticPkg.htm">Tcl_StaticPackage</A></B>
<div class="copy">Copyright &copy; 1996 Sun Microsystems, Inc.
</div>
</BODY></HTML>
